/**
 * Copyright(c) Hainan eKing Technology co., LTD
 *
 * @date 2013-11-6
 * 	
 * Original Author: 郑兴(zhengxing)
 *
 * ChangeLog
 *
 */
package com.hnas.common.web;

import java.io.Serializable;

/**
 * @author 郑兴(zhengxing)
 *
 */
public class BaseAjaxResponse implements Serializable {
	private static final long serialVersionUID = -1063911693846038591L;
	public static final int SUCCESS = 1;
	public static final int FAIL = 0;
	private int result = FAIL;
	private String errorMessage;
	private Object resultData;
	
	
	public BaseAjaxResponse(){}
	public BaseAjaxResponse retrunSuccess(BaseAjaxResponse res){
		res.setErrorMessage("操作成功！");
		res.setResult(SUCCESS);
		return res;
	}
	
	public BaseAjaxResponse retrunSuccess(BaseAjaxResponse res,Object obj){
		res.setErrorMessage("操作成功！");
		res.setResult(SUCCESS);
		res.setResultData(obj);
		return res;
	}
	
	public BaseAjaxResponse retrunFail(BaseAjaxResponse res){
		res.setErrorMessage("操作失败！");
		res.setResult(FAIL);
		return res;
	}
	
	public BaseAjaxResponse retrunFail(BaseAjaxResponse res,Object obj){
		res.setErrorMessage("操作失败！");
		res.setResult(FAIL);
		res.setResultData(obj);
		return res;
	}
	
	public Object getResultData() {
		return resultData;
	}
	public void setResultData(Object resultData) {
		this.resultData = resultData;
	}
	/**
	 * @return the result
	 */
	public int getResult() {
		return result;
	}
	/**
	 * @param result the result to set
	 */
	public void setResult(int result) {
		this.result = result;
	}
	/**
	 * @return the errorMessage
	 */
	public String getErrorMessage() {
		return errorMessage;
	}
	/**
	 * @param errorMessage the errorMessage to set
	 */
	public void setErrorMessage(String errorMessage) {
		this.errorMessage = errorMessage;
	}
}
